﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chapter10
{
    using Chapter10.View;

    /// <summary>
    /// 第10章 资源
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            #region 01 资源基础
            /*
             * 01 资源集合
             * 02 资源的层次
             * 03 静态资源和动态资源
             * 04 非共享资源
             * 05 通过代码访问资源
             * 06 应用程序资源
             * 07 系统资源
             * */
            #endregion

            #region 02 资源字典
            /*
             * 01 创建资源字典
             * 02 使用资源字典
             * 03 在程序集之间共享资源
             * */
            #endregion

            #region 03 小结
            #endregion
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Open)
            {
                var button = e.Source as Button;
                if (button != null)
                {
                    if (button == button1)
                    {
                        Demo(new ResourcesWindow());
                    }
                }
            }
        }

        private void Demo(Window window)
        {
            window.Owner = this;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
        }
    }
}
